#include <bits/stdc++.h>
using namespace std;

using i64 = long long;
const int N = 2e5 + 10, P = 998244353;

int inv[N], fact[N], invFact[N];

int C(int n, int m) {
    if(m < 0 || m > n) return 0;
    return fact[n] * (i64)invFact[m] % P * invFact[n - m] % P;
}

int main() {
    fact[0] = fact[1] = inv[1] = invFact[0] = invFact[1] = 1;
    for(int i = 2; i < N; i ++) {
        inv[i] = (P - P / i) * (i64)inv[P % i] % P;
        fact[i] = fact[i - 1] * (i64)i % P;
        invFact[i] = invFact[i - 1] * (i64)inv[i] % P;
    }

    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, m;
    cin >> n >> m;

    vector<int> cnt(m + 1);
    map<pair<int, int>, int> cntp;

    for(int i = 1, op, a, b; i <= n; i ++) {
        cin >> op;
        if(op == 1) {
            cin >> a;
            cnt[a] ++;
        }else{
            cin >> a >> b;
            cnt[a] ++;
            cnt[b] ++;
            cntp[{a, b}] ++;
        }
    }

    vector<int> ans(n + 1);

    for(int i = 1; i <= n; i ++) ans[i] = C(n, i);

    for(int i = 1; i <= m; i ++) {
        for(int j = 1; j <= cnt[i]; j ++)
            ans[j] = (ans[j] + P - C(cnt[i], j)) % P;
    }

    for(auto &[p, x] : cntp)
        for(int j = 1; j <= x; j ++)
            ans[j] = (ans[j] + C(x, j)) % P;

    for(int i = 1; i <= n; i ++)
        cout << ans[i] << " \n"[i == n];
    return 0;
}